package com.chuangke.sinotrukbudget.util;

import java.util.List;

import org.apache.commons.collections.CollectionUtils;

import com.alibaba.druid.util.StringUtils;
import com.chuangke.core.exception.ChuangkeException;

public class BudgetValidateUtil {
	
	public static void validateParam(String tCategory,String time) {
		if (StrUtil.isBlank(tCategory)) {
			throw new ChuangkeException("请选择预算版本");
		}
		if (StrUtil.isBlank(time)) {
			throw new ChuangkeException("请选择预算期间");
		}
	}
	
	/**
	 * 预算参数校验
	 * @param tCategory
	 * @param time
	 * @param deptId
	 * @param accountIds
	 */
	public static void validateParam(String tCategory,String time, String deptId,List<String> accountIds) {
		if (StrUtil.isBlank(tCategory)) {
			throw new ChuangkeException("请选择预算版本");
		}
		if (StrUtil.isBlank(time)) {
			throw new ChuangkeException("请选择预算期间");
		}
		if (CollectionUtils.isEmpty(accountIds)) {
			throw new ChuangkeException("请选择预算科目");
		}
		if (StrUtil.isBlank(deptId)) {
			throw new ChuangkeException("请选择组织机构");
		}
	}
	
	/**
	 * 预算参数校验
	 * @param tCategory
	 * @param time
	 * @param deptIds
	 * @param accountIds
	 */
	public static void validateParam(String tCategory,String time, List<String> deptIds,List<String> accountIds) {
		if (StrUtil.isBlank(tCategory)) {
			throw new ChuangkeException("请选择预算版本");
		}
		if (StrUtil.isBlank(time)) {
			throw new ChuangkeException("请选择预算期间");
		}
		if (CollectionUtils.isEmpty(deptIds)) {
			throw new ChuangkeException("请选择组织机构");
		}
		if (CollectionUtils.isEmpty(accountIds)) {
			throw new ChuangkeException("请选择预算科目");
		}
	}

}
